package dao;

import pojo.Category;
import utils.DH;

import java.util.List;

public class CategoryDao {
    /**
     *
     * @return
     */
    public List<Category> queryAllCategory() {
        String sql = "select * from t_category";
        List list = DH.getall(sql, new Category(), null);
        return list;
    }

    /**
     *
     * @param id
     * @return
     */
    public Category queryAllCategoryById(String id) {
        String sql = "select * from t_category where id=?";
        String[] agrs={id};
        List list = DH.getall(sql, new Category(), agrs);
        if (list!=null && list.size()>0){
            Category cate =(Category)list.get(0);
            return cate;
        }

       return null;
    }
}
